<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.prime.com.tr/ui"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">
<h:form id="form">
    <ol>
        <li>
            <label for="destination_from">Fran:</label>
            #{ReservationBean.load()}
            #{FlightBoxModel.load()}
            <h:selectOneMenu id="destination_from" value="#{FlightBoxModel.fromDestination}">
                <f:selectItems value="#{FlightBoxModel.listFromDestinations}"/>
                <f:ajax render="destination_to" listener="#{FlightBoxModel.load()}"/>
            </h:selectOneMenu>
        </li>
        <li>
        <label for="destination_to">Till:</label>
            <h:selectOneMenu id="destination_to" value="#{FlightBoxModel.toDestination}">
                <f:selectItems value="#{FlightBoxModel.listToDestinations}"/>
            </h:selectOneMenu>
        </li>
    </ol>
    <h:commandButton id="addButton"
                                 value="Nasta steg"
                                 action="#{FlightBoxController.nextStep}">
        <f:setPropertyActionListener target="#{FlightBoxController.fromDestination}" value="#{FlightBoxModel.fromDestination}"/>
        <f:setPropertyActionListener target="#{FlightBoxController.toDestination}" value="#{FlightBoxModel.toDestination}"/>
    </h:commandButton>
</h:form>
</ui:composition>